package router

import (
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/net/ghttp"
	"websshop/app/admin/base"
	"websshop/app/admin/goods"
	"websshop/app/admin/user"
	"websshop/app/service/middleware"
)

func init() {
	s := g.Server()
	s.Group("/admin", func(group *ghttp.RouterGroup) {
		group.GET("/user/login", new(user.Controller),"Login")
		group.POST("/user/login", new(user.Controller),"Login")
		group.GET("/captcha/{id}", new(user.Controller), "Captcha")
		group.Group("/", func(group *ghttp.RouterGroup) {
			group.Middleware(middleware.Auth)
			group.ALL("/base", new(base.Controller))
			group.ALL("/goods", new(goods.Controller))
			group.POST("/goods/list", new(goods.Controller),"List")
			group.GET("/user/logout", new(user.Controller), "Logout")
		})
	})
}
